<template>
	<view :class="[BackGround]" :style="[{'font-weight':Style,'font-family':Font,height:100 + '%',minHeight:height + 'px'}]">
		<cu-custom bgColor="bg-gradual-blue" isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">工作提醒</view>
		</cu-custom>
		<view class="nav Allsearch">
			<view class="flex bg-white">
				<view @tap="tabSelect(0)" :class="['cu-item flex-sub text-center padding-sm margin-xs radius bor',0==TabCur?'text-blue cur':'']">订单审核</view>
				<view @tap="tabSelect2(1)" :class="['cu-item flex-sub text-center padding-sm margin-xs radius',1==TabCur?'text-blue cur':'']">消息提醒</view>
			</view>
		</view>
		<view v-if="page">
			<!-- 下拉刷新组件 -->
			<mix-pulldown-refresh ref="mixPulldownRefresh" :num="94" :top="CustomBar + 94 " :scrolltopa="scrollTop"
			 @refresh="onPulldownReresh" @setEnableScroll="setEnableScroll" @loadMore='loadMore' @scroll='scroll'>
				<!-- 数据列表组件 -->
				<first-list :deliverplan="deliverplan" #default="{item}" :startisShow="false">
					<view class="laoda_two" @tap="jump(item)">
						<view class="flex padding-xs justify-between text-bold">
							<view>{{item.LMODULENAME}}</view>
						</view>
						<view class="flex padding-xs justify-between">
							<view>{{item.LSENDINFO}}</view>
						</view>
					</view>
				</first-list>
				<!-- 上滑加载更多组件 -->
				<mix-load-more :status="2" v-if="!isFlag"></mix-load-more>
			</mix-pulldown-refresh>
			<back-top v-if="isShow" @topClick="topClick">
				<image class="topimg" mode="aspectFit" src="https://www.ahlinghui.com/Uploads/image/20190429/images/BackTop.png"></image>
			</back-top>
			<lime-tips v-if="isFlag" :fixed="true" imgUrl="/static/images/img_noorder@3x.png">咦！暂时没有数据呢……</lime-tips>
		</view>
		<view v-else>
			<view style="margin-top: 100rpx;">
				<block v-for="(item,index) in dataList" :key="index">
					<tui-collapse :index="index" :current="item.current" :disabled="item.disabled" @click="change">
						<template v-slot:title>
							<tui-list-cell :hover="!item.disabled">{{item.LMODULENAME}}</tui-list-cell>
						</template>
						<template v-slot:content>
							<view :class="[BackGroundBox,'tui-content padding-sm']">{{item.LMSGTITLE}}</view>
							<view :class="[BackGroundBox,'tui-content padding-sm']">{{item.LSENDINFO}}</view>
						</template>
					</tui-collapse>
				</block>
			</view>
			<lime-tips v-if="isFlag2" :fixed="true" imgUrl="/static/images/img_noorder@3x.png">咦！暂时没有数据呢……</lime-tips>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import {
		inputSearch,
		scrollrefresh
	} from "@/mixin/mixin.js"
	import {
		getrequestReport
	} from "@/service/selectList"
	import mixPulldownRefresh from '@/colorui/components/mixpulldownrefresh.vue'
	import mixLoadMore from '@/colorui/components/mixloadmore';
	import FirstList from '@/colorui/components/FirstList.nvue'
	import BackTop from '@/colorui/components/BackTop.vue'
	import ButtonFather from '@/colorui/components/ButtonFather.vue'
	import tuiCollapse from "@/colorui/components/tui-collapse/tui-collapse"
	import tuiListCell from "@/colorui/components/list-cell/list-cell"
	export default {
		mixins: [inputSearch, scrollrefresh],
		data() {
			return {
				height: this.screenHeight,
				TabCur: 0,
				page: true,
				dataList: [],
				placeholder: '名称',
				message: '筛选',
				isShow: false,
				flag: true,
				isFlag: false,
				isFlag2: false,
				count: 0,
				dateleft: global.dateleft,
				dateright: global.dateright,
				CustomBar: this.CustomBar,
				deliverplan: []
			}
		},
		computed: {
			...mapGetters([
				'Style', 'Font', 'BackGround', 'BackGroundBox'
			])
		},
		components: {
			mixPulldownRefresh,
			mixLoadMore,
			FirstList,
			BackTop,
			ButtonFather,
			tuiCollapse,
			tuiListCell
		},
		onLoad() {
			getrequestReport(global.userinfo.lusercode,'WaitForAudit','').then(res => {
				if(res.code == 1) {
					res.data.forEach((val,index) => {
						val['isShow'] = true
					})
					this.isFlag = false
					this.deliverplan = res.data
				} else {
					this.isFlag = true
				}
			})
			
		},
		methods: {
			change(e) {
				let index = e.index;
				let item = this.dataList[index];
				item.current = item.current == index ? -1 : index
			},
			tabSelect(e) {
				this.TabCur = e
				this.page = true
			},
			tabSelect2(e) {
				getrequestReport(global.userinfo.lusercode,'Warning','').then(res => {
					if(res.code == 1) {
						res.data.forEach((val,index) => {
							val['current'] = 0
							val['disabled'] = false
						})
						this.isFlag2 = false
						this.dataList = res.data
					} else {
						this.isFlag2 = true
					}
				})
				this.TabCur = e
				this.page = false
			},
			jump(item) {
				uni.navigateTo({
					url: `./Handle?lid=${item.LID}`
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.bor {
		border-right: 2rpx solid #eee;
	}

	.Allsearch {
		position: fixed;
		left: 0rpx;
		right: 0rpx;
		z-index: 1;
		box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, .1)
	}

	.tui-content {
		color: #888;
	}

	.tui-collapse {
		border-radius: 20rpx;
	}
</style>
